package oop;

import java.util.Scanner;

/**
 * @ClassName : oop.Demo06
 * @Author : LV88VL
 * @Date: 2021/2/3 10:47
 * @Description : 计算机
 */
public class Demo06 {
    public static void main(String[] args) {
        int a,b,c;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个类似5+3的表达式");
        a=scanner.nextInt();
        c=scanner.next().charAt(0);
        b=scanner.nextInt();
        switch (c){
            case '+' :
                add(a,b);
                break;
            case '-' :
                jian(a,b);
                break;
            case '*' :
                cheng(a,b);
                break;
            case '/' :
                chu(a,b);
                break;
            default:
                System.out.println("输入错误");
                break;
        }
        scanner.close();
    }
    public static void add(int a,int b){
        int sum=a+b;
        System.out.println("两数和"+ sum);
    }
    public static void jian(int a,int b){
        int sum=a-b;
        System.out.println("两数差"+ sum);
    }
    public static void cheng(int a,int b){
        int sum=a*b;
        System.out.println("两数商"+sum);
    }
    public static void chu(int a,int b){
        if (b==0){
            System.out.println("除数不能为0");
        }else{
            int sum=a/b;
            System.out.println("两数商"+sum);
        }

    }
}
